package ui.view;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Group;

public class Test extends ViewPart {

	public static final String ID = "ui.view.Test"; //$NON-NLS-1$
	private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
	private Text text;
	private Text text_1;
	private Text text_2;

	public Test() {
	}

	/**
	 * Create contents of the view part.
	 * @param parent
	 */
	@Override
	public void createPartControl(Composite parent) {
		parent.setLayout(new FillLayout(SWT.HORIZONTAL));
		
		Composite composite = new Composite(parent, SWT.BORDER);
		toolkit.adapt(composite);
		toolkit.paintBordersFor(composite);
		composite.setLayout(new GridLayout(3, true));
		
		Label lblNewLabel = new Label(composite, SWT.BORDER);
		lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
		toolkit.adapt(lblNewLabel, true, true);
		lblNewLabel.setText("名称");
		
		text = new Text(composite, SWT.BORDER);
		text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
		toolkit.adapt(text, true, true);
		
		Label lblNewLabel_1 = new Label(composite, SWT.NONE);
		toolkit.adapt(lblNewLabel_1, true, true);
		lblNewLabel_1.setText("New Label");
		
		Combo combo = new Combo(composite, SWT.NONE);
		combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		toolkit.adapt(combo);
		toolkit.paintBordersFor(combo);
		
		Label lblNewLabel_2 = new Label(composite, SWT.NONE);
		lblNewLabel_2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
		toolkit.adapt(lblNewLabel_2, true, true);
		lblNewLabel_2.setText("New Label");
		
		Label lblNewLabel_3 = new Label(composite, SWT.NONE);
		toolkit.adapt(lblNewLabel_3, true, true);
		lblNewLabel_3.setText("New Label");
		
		Canvas canvas = new Canvas(composite, SWT.BORDER);
		GridData gd_canvas = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 5);
		gd_canvas.heightHint = 121;
		gd_canvas.widthHint = 184;
		canvas.setLayoutData(gd_canvas);
		toolkit.adapt(canvas);
		toolkit.paintBordersFor(canvas);
		
		List list = new List(composite, SWT.BORDER);
		GridData gd_list = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 6);
		gd_list.heightHint = 206;
		gd_list.widthHint = 173;
		list.setLayoutData(gd_list);
		toolkit.adapt(list, true, true);
		
		Button btnNewButton = new Button(composite, SWT.NONE);
		toolkit.adapt(btnNewButton, true, true);
		btnNewButton.setText("New Button");
		
		Button btnNewButton_1 = new Button(composite, SWT.NONE);
		toolkit.adapt(btnNewButton_1, true, true);
		btnNewButton_1.setText("New Button");
		new Label(composite, SWT.NONE);
		new Label(composite, SWT.NONE);
		
		Group grpGroup = new Group(composite, SWT.NONE);
		grpGroup.setTouchEnabled(true);
		grpGroup.setText("Group");
		GridLayout gl_grpGroup = new GridLayout(2, false);
		grpGroup.setLayout(gl_grpGroup);
		GridData gd_grpGroup = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
		gd_grpGroup.widthHint = 179;
		grpGroup.setLayoutData(gd_grpGroup);
		toolkit.adapt(grpGroup);
		toolkit.paintBordersFor(grpGroup);
		
		Label lblNewLabel_5 = new Label(grpGroup, SWT.NONE);
		toolkit.adapt(lblNewLabel_5, true, true);
		lblNewLabel_5.setText("New Label");
		
		text_1 = new Text(grpGroup, SWT.BORDER);
		GridData gd_text_1 = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
		gd_text_1.widthHint = 282;
		text_1.setLayoutData(gd_text_1);
		toolkit.adapt(text_1, true, true);
		
		Label lblNewLabel_4 = new Label(grpGroup, SWT.NONE);
		toolkit.adapt(lblNewLabel_4, true, true);
		lblNewLabel_4.setText("New Label");
		
		text_2 = new Text(grpGroup, SWT.BORDER);
		GridData gd_text_2 = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
		gd_text_2.widthHint = 292;
		text_2.setLayoutData(gd_text_2);
		toolkit.adapt(text_2, true, true);
		new Label(composite, SWT.NONE);
		new Label(composite, SWT.NONE);
		new Label(composite, SWT.NONE);

		createActions();
		initializeToolBar();
		initializeMenu();
	}

	public void dispose() {
		toolkit.dispose();
		super.dispose();
	}

	/**
	 * Create the actions.
	 */
	private void createActions() {
		// Create the actions
	}

	/**
	 * Initialize the toolbar.
	 */
	private void initializeToolBar() {
		//IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
	}

	/**
	 * Initialize the menu.
	 */
	private void initializeMenu() {
		//IMenuManager manager = getViewSite().getActionBars().getMenuManager();
	}

	@Override
	public void setFocus() {
		// Set the focus
	}
}
